<template>
  <div class="container">
    <div class="top">
      <el-date-picker
        value-format="yyyy-MM-dd"
        v-model="date"
        type="daterange"
        :clearable="false"
        range-separator="至"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
      ></el-date-picker>
      <el-select
        v-model="search.area"
        filterable
        remote
        center
        reserve-keyword
        placeholder="请输入区域"
        :remote-method="insideRemoteMethods"
        :loading="insideArea.loading"
      >
        <el-option
          v-for="item in insideArea.options"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        ></el-option>
      </el-select>
      <el-input
        style="width: 150px; margin-bottom: 5px"
        v-model="search.code"
        placeholder="请输入单据编号"
        clearable
      ></el-input>
      <el-select v-model="search.is_normal" placeholder="结算状态">
        <el-option
          v-for="item in is_normalList"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        ></el-option>
      </el-select>
      <el-select v-model="search.kind" placeholder="请选择业务类型">
        <el-option
          v-for="item in businessType"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        ></el-option>
      </el-select>
      <el-select v-model="search.supplier_type" placeholder="请选择供应商类别">
        <el-option
          v-for="item in supplierType"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        ></el-option>
      </el-select>
      <el-input
        style="width: 150px; margin-bottom: 5px"
        v-model="search.spec"
        placeholder="请输入规格"
        clearable
      ></el-input>
      <el-input
        style="width: 150px; margin-bottom: 5px"
        v-model="search.unit"
        placeholder="请输入单位"
        clearable
      ></el-input>
    </div>
    <div class="inpList">
      <el-input
        style="width: 300px"
        :disabled="true"
        placeholder="请搜索供应商信息"
        v-model="supplierNameList.name"
      >
        <template slot="prepend">供应商</template>
        <el-button
          slot="append"
          icon="el-icon-search"
          @click="supplierBtn"
        ></el-button>
      </el-input>
      <el-input
        style="width: 300px"
        :disabled="true"
        placeholder="请搜索商品信息"
        v-model="commodityNameList.name"
      >
        <template slot="prepend">商品</template>
        <el-button
          slot="append"
          icon="el-icon-search"
          @click="commodityBtn"
        ></el-button>
      </el-input>
      <el-input
        style="width: 300px"
        :disabled="true"
        placeholder="请搜索类别信息"
        v-model="classNameList.name"
      >
        <template slot="prepend">类别</template>
        <el-button
          slot="append"
          icon="el-icon-search"
          @click="classBtn"
        ></el-button>
      </el-input>
      <el-input
        style="width: 300px"
        :disabled="true"
        placeholder="请搜索采购员信息"
        v-model="purchaseList.name"
      >
        <template slot="prepend">采购员</template>
        <el-button
          slot="append"
          icon="el-icon-search"
          @click="purchaseBtn"
        ></el-button>
      </el-input>

      <el-input
        style="width: 300px"
        :disabled="true"
        placeholder="请搜索仓库"
        v-model="warehouseList.name"
      >
        <template slot="prepend">仓库</template>
        <el-button
          slot="append"
          icon="el-icon-search"
          @click="warehouseBtn"
        ></el-button>
      </el-input>
    </div>
    <div class="inpList">
      <el-select v-model="optionsSixId" @change="optionsSixMethods">
        <el-option
          v-for="item in optionsSix"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        ></el-option>
      </el-select>
      <el-input
        style="width: 150px; margin-bottom: 5px"
        v-model="optionsSixMinVal"
        clearable
        placeholder="请输入最小价格"
        @change="inp(1, optionsSixMinVal)"
      ></el-input
      >&nbsp;-
      <el-input
        @change="inp(2, optionsSixMaxVal)"
        style="width: 150px; margin-bottom: 5px"
        v-model="optionsSixMaxVal"
        clearable
        placeholder="请输入最大价格"
      ></el-input>
      <el-select v-model="optionsFiveId" @change="optionsFiveMethods">
        <el-option
          v-for="item in optionsFive"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        ></el-option>
      </el-select>
      <el-input
        style="width: 150px; margin-bottom: 5px"
        v-model="optionsFiveMinVal"
        @change="inps(1, optionsFiveMinVal)"
        clearable
        placeholder="请输入最小重量"
      ></el-input
      >&nbsp;-
      <el-input
        style="width: 150px; margin-bottom: 5px"
        v-model="optionsFiveMaxVal"
        @change="inps(2, optionsFiveMaxVal)"
        clearable
        placeholder="请输入最大重量"
      ></el-input>
    </div>
    <div class="inpList">
      <el-button>金额</el-button>
      <el-input
        style="width: 150px; margin-bottom: 5px"
        v-model="search.start_amount"
        placeholder="请输入最小金额"
        clearable
      ></el-input
      >&nbsp;-
      <el-input
        style="width: 150px; margin-bottom: 5px"
        v-model="search.end_amount"
        placeholder="请输入最大金额"
        clearable
      ></el-input>
      <el-button
        size="small"
        type="primary"
        icon="el-icon-search"
        class="handleSearch"
        @click="handleSearch()"
        >查询</el-button
      >
      <el-button
        size="small"
        type="danger"
        class="handleSearch"
        icon="el-icon-delete"
        @click="empty()"
        >清空</el-button
      >
      <!-- <el-button class="add" icon="el-icon-refresh" size="small" type="success" @click="refresh">刷新</el-button> -->
      <el-button
        type="info"
        size="small"
        icon="el-icon-tickets"
        @click="derive()"
        >导出</el-button
      >
    </div>
    <el-table
      max-height="600"
      :data="tableData"
      border
      style="width: 100%"
      empty-text="暂无数据"
      :summary-method="getSummaries"
      show-summary
    >
      <el-table-column prop="num" label="序号" align="center"></el-table-column>
      <el-table-column
        prop="date"
        label="单据日期"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="code"
        label="单据编号"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="kind_name"
        label="业务类型"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="scode"
        label="结算单号"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="storehouse_code"
        label="仓库编码"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="storehouse_name"
        label="仓库名称"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="buyer_code"
        label="采购员编码"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="buyer"
        label="采购员名称"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="supplier_orgarea_name"
        label="供应商所属区域"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="supplier_type"
        label="供应商类别"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="supplier_code"
        label="供应商编码"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="supplier_name"
        label="供应商名称"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="productclass_id"
        label="供应商类别编码"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="class_name"
        label="商品类别"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="erp_goods_code"
        label="商品编码"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="goods_name"
        label="商品名称"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="spec"
        label="规格"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="unit"
        label="单位"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="purchase_num"
        label="毛重"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="inp_num"
        label="净重"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="inp_price"
        label="净单价"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="purchase_price"
        label="毛单价"
        align="center"
      ></el-table-column>
      <el-table-column prop="qty" label="箱数" align="center"></el-table-column>
      <el-table-column
        prop="amount"
        label="金额"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="make_user"
        label="制单人"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="check_user"
        label="审核人"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="normalMsg"
        label="结算方式"
        align="center"
      ></el-table-column>
    </el-table>
    <!-- 分页 -->
    <pagination
      @page="handleSizeChange"
      @pagesize="handleCurrentChange"
      :pageData="pageData"
    ></pagination>
    <div style="height: 0">
      <purchaseDialog
        :purchasedialog="purchasedialog"
        @tag="purchaseTag"
      ></purchaseDialog>
      <supplierSearch
        :supplierdialog="supplierdialog"
        @tag="supplierTag"
      ></supplierSearch>
      <commodityDialog
        :commoditydialog="commoditydialog"
        @tag="commodityTag"
      ></commodityDialog>
      <classDialog :classdialog="classdialog" @tag="classTag"></classDialog>
      <warehouseselect
        :warehouseselect="warehouseselect"
        @tag="warehouseTag"
      ></warehouseselect>
    </div>
  </div>
</template>
<script>
import { getnowDate } from "@/utils/index";
import Pagination from "@/components/pagination";
import PurchaseDialog from "@/components/grossMargin/purchaseDialog";
import SupplierSearch from "@/components/grossMargin/supplierSearch";
import CommodityDialog from "@/components/grossMargin/commodityDialog";
import ClassDialog from "@/components/grossMargin/classDialog";
import { buyInDetail } from "@/api/grossMargin/grossMarginList";
import { getToken } from "@/utils/auth";
import { classifyList } from "@/api/commodity/commodityList";
import { getAreaList } from "@/api/permission/adminlist";
import Warehouseselect from "@/components/commodity/warehouseselect";
export default {
  components: {
    pagination: Pagination,
    purchaseDialog: PurchaseDialog,
    supplierSearch: SupplierSearch,
    commodityDialog: CommodityDialog,
    classDialog: ClassDialog,
    warehouseselect: Warehouseselect,
  },
  data() {
    return {
      //页面数据
      tableData: [],
      is_normalList: [
        {
          value: "-1",
          label: "全部",
        },
        {
          value: "0",
          label: "不结算",
        },
        {
          value: " 1",
          label: "正常结算",
        },
        {
          value: "2",
          label: "非正常结算",
        },
      ],
      //分页
      pageData: {
        pageSizes: [10, 20],
        pageSize: 10,
        page: 1,
        total: null,
        layout: "total, sizes, prev, pager, next, jumper",
      },
      //默认时间
      normal_startime: getnowDate().startimer,
      normal_endtime: getnowDate().endtimer,
      search: {
        start_date: "",
        end_date: "",
        is_normal: "",
        code: "",
        kind: "",
        orgarea_name: "",
        supplier_type: "",
        supplier_code: "",
        supplier_name: "",
        goods_name: "",
        erp_goods_code: "",
        classid: "",
        buyer: "",
        buyer_code: "",
        spec: "",
        unit: "",
        start_purchase_num: "",
        end_purchase_num: "",
        start_inp_num: "",
        end_inp_num: "",
        start_purchase_price: "",
        end_purchase_price: "",
        start_inp_price: "",
        end_inp_price: "",
        start_amount: "",
        end_amount: "",
        area: "",
      },
      superSearch: {
        supplier: "",
      },
      supplierType: [
        {
          value: "1",
          label: "全部",
        },
        {
          value: "产地供应商",
          label: "产地供应商",
        },
        {
          value: "生产厂家",
          label: "生产厂家",
        },
        {
          value: "批发市场",
          label: "批发市场",
        },
        {
          value: "种植基地",
          label: "种植基地",
        },
        {
          value: "门店自采",
          label: "门店自采",
        },
        {
          value: "其他",
          label: "其他",
        },
      ],
      insideArea: {
        innerVisible: false,
        options: [],
        value: "",
        list: [],
        loading: false,
      },
      businessType: [
        {
          value: "1",
          label: "全部",
        },
        {
          value: "10",
          label: "购货入库",
        },
        {
          value: "30",
          label: "退货入库",
        },
        {
          value: "40",
          label: "分货入库",
        },
        {
          value: "50",
          label: "赠品入库",
        },
      ],
      optionsOne: [
        {
          value: "",
          label: "仓库名称",
        },
        {
          value: "1",
          label: "仓库编码",
        },
      ],
      optionsOneId: "",
      optionsOneVal: "",
      optionsFive: [
        {
          value: "",
          label: "毛重",
        },
        {
          value: "1",
          label: "净重",
        },
      ],
      optionsFiveId: "",
      optionsFiveMinVal: "",
      optionsFiveMaxVal: "",
      optionsSix: [
        {
          value: "",
          label: "毛单价",
        },
        {
          value: "1",
          label: "净单价",
        },
      ],
      optionsSixId: "",
      optionsSixMinVal: "",
      optionsSixMaxVal: "",

      outer: {
        options: [],
        value: "",
        list: [],
        loading: false,
        id: "",
      },
      date: [],
      //dialog信息
      supplierdialog: {
        centerDialogVisible: false,
      },
      commoditydialog: {
        centerDialogVisible: false,
      },
      purchasedialog: {
        centerDialogVisible: false,
      },
      classdialog: {
        centerDialogVisible: false,
      },
      warehouseselect: {
        centerDialogVisible: false,
      },
      warehouseList: {
        name: "",
        code: "",
      },
      supplierNameList: {
        name: "",
        code: "",
      },
      commodityNameList: {
        name: "",
        code: "",
      },
      purchaseList: {
        name: "",
        code: "",
      },
      classNameList: {
        name: "",
        code: "",
      },
    };
  },
  created() {
    this.search.start_date = this.normal_startime;
    this.search.end_date = this.normal_endtime;
    if (this.normal_startime) {
      this.date.push(this.search.start_date);
    }
    if (this.normal_endtime) {
      this.date.push(this.search.end_date);
    }
    // this.getData();
    this.getAreaData();
  },
  methods: {
    //获取页面数据
    getData() {
      let data = {
        limit: this.pageData.pageSize,
        page: this.pageData.page,
        start_date: this.search.start_date,
        end_date: this.search.end_date,
        code: this.search.code,
        warehouse_code: this.warehouseList.code,
        orgarea_name: this.search.orgarea_name,
        supplier_type:
          this.search.supplier_type == 1 ? "" : this.search.supplier_type,
        supplier_id: this.supplierNameList.code,
        goods_name: this.commodityNameList.name,
        erp_goods_code: this.commodityNameList.code,
        classid: this.classNameList.code,
        buyer: this.purchaseList.name,
        buyer_code: this.purchaseList.code,
        spec: this.search.spec,
        unit: this.search.unit,
        kind: this.search.kind == 1 ? "" : this.search.kind,
        start_purchase_num: this.search.start_purchase_num,
        end_purchase_num: this.search.end_purchase_num,
        start_inp_num: this.search.start_inp_num,
        end_inp_num: this.search.end_inp_num,
        start_purchase_price: this.search.start_purchase_price,
        end_purchase_price: this.search.end_purchase_price,
        start_inp_price: this.search.start_inp_price,
        end_inp_price: this.search.end_inp_price,
        start_amount: this.search.start_amount,
        end_amount: this.search.end_amount,
        is_normal: this.search.is_normal == -1 ? "" : this.search.is_normal,
        orgarea_code_str: this.search.area,
      };
      buyInDetail(data)
        .then((res) => {
          if (res.code == 0) {
            res.data.data.forEach((result) => {
              switch (result.is_normal) {
                case 0:
                  result.normalMsg = "不结算";
                  break;
                case 1:
                  result.normalMsg = "正常结算";
                  break;
                case 2:
                  result.normalMsg = "非正常结算";
                  break;
              }
            });
            this.tableData = res.data.data;
            this.pageData.page = res.data.current_page;
            this.pageData.pagesize = res.data.per_page;
            this.pageData.total = res.data.total;
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    getAreaData() {
      let data = {
        page: 1,
        limit: 50,
      };

      //获取初始化区域列表
      getAreaList(data).then((res) => {
        this.insideArea.options = res.data.listdata.map((item) => {
          return { value: `${item.code}`, label: `${item.name}` };
        });
      });
    },
    // 搜索区域
    insideRemoteMethods(query) {
      if (query !== "") {
        this.getSupplierLists(query);
      } else {
        this.insideArea.options = [];
      }
    },
    getSupplierLists(query) {
      let data = {
        name: query,
        page: 1,
        limit: 100,
      };
      getAreaList(data).then((res) => {
        this.insideArea.list = res.data.listdata.map((item) => {
          return { value: `${item.code}`, label: `${item.name}` };
        });
        this.insideArea.options = this.insideArea.list.filter((item) => {
          this.insideArea.loading = false;
          return item.label.toLowerCase().indexOf(query.toLowerCase()) > -1;
        });
      });
    },
    supplierTag(data) {
      this.supplierNameList = {
        name: "",
        code: "",
      };

      let arrName = [];
      let arrCode = [];
      data.forEach((res) => {
        arrName.push(res.name);
        arrCode.push(res.code);
      });
      this.supplierNameList.name = arrName.join(",");
      this.supplierNameList.code = arrCode.join(",");
    },
    //毛单价、净单价
    inp(num, val) {
      if (this.optionsSixId == "") {
        if (num == 1) {
          this.search.start_purchase_price = val;
        } else {
          this.search.end_purchase_price = val;
        }
      } else {
        if (num == 1) {
          this.search.start_inp_price = val;
        } else {
          this.search.end_inp_price = val;
        }
      }
    },
    //毛重、净重
    inps(num, val) {
      if (this.optionsFiveId == "") {
        if (num == 1) {
          this.search.start_purchase_num = val;
        } else {
          this.search.end_purchase_num = val;
        }
      } else {
        if (num == 1) {
          this.search.start_inp_num = val;
        } else {
          this.search.end_inp_num = val;
        }
      }
    },
    commodityTag(data) {
      this.commodityNameList = {
        name: "",
        code: "",
      };

      let arrName = [];
      let arrCode = [];
      data.forEach((res) => {
        arrName.push(res.name);
        arrCode.push(res.code);
      });
      this.commodityNameList.name = arrName.join(",");
      this.commodityNameList.code = arrCode.join(",");
    },
    purchaseTag(data) {
      this.purchaseList = {
        name: "",
        code: "",
      };

      let arrName = [];
      let arrCode = [];
      data.forEach((res) => {
        arrName.push(res.name);
        arrCode.push(res.code);
      });
      this.purchaseList.name = arrName.join(",");
      this.purchaseList.code = arrCode.join(",");
    },
    classTag(data) {
      this.classNameList = {
        name: "",
        code: "",
      };

      let arrName = [];
      let arrCode = [];
      data.forEach((res) => {
        arrName.push(res.name);
        arrCode.push(res.id);
      });
      this.classNameList.name = arrName.join(",");
      this.classNameList.code = arrCode.join(",");
    },
    warehouseTag(data) {
      this.warehouseList = {
        name: "",
        code: "",
      };
      console.log(data, 11111);
      let arrName = [];
      let arrCode = [];
      data.forEach((res) => {
        arrName.push(res.name);
        arrCode.push(res.code);
      });
      this.warehouseList.name = arrName.join(",");
      this.warehouseList.code = arrCode.join(",");
    },
    //超级仓库搜索
    warehouseBtn() {
      this.warehouseselect = {
        centerDialogVisible: true,
      };
    },
    //超级供应商搜索
    supplierBtn() {
      this.supplierdialog = {
        centerDialogVisible: true,
      };
    },
    //超级商品搜索
    commodityBtn() {
      this.commoditydialog = {
        centerDialogVisible: true,
      };
    },
    //超级采购员搜索
    purchaseBtn() {
      this.purchasedialog = {
        centerDialogVisible: true,
      };
    },
    //超级类别搜索
    classBtn() {
      this.classdialog = {
        centerDialogVisible: true,
      };
    },
    superSelect() {},
    // 导出
    derive() {
      this.$confirm("是否导出?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let is_normal =
            this.search.is_normal == -1 ? "" : this.search.is_normal;
          let kind = this.search.kind == 1 ? "" : this.search.kind;
          let supplier_type =
            this.search.supplier_type == 1 ? "" : this.search.supplier_type;
          let link = document.createElement("a");
          link.href = `${
            this.$axios.defaults.baseURL
          }/api/Report/exportBuyInDetail?token=${getToken()}&start_date=${
            this.search.start_date
          }&end_date=${this.search.end_date}&code=${
            this.search.code
          }&kind=${kind}&orgarea_name=${
            this.search.orgarea_name
          }&supplier_type=${supplier_type}&supplier_id=${
            this.supplierNameList.code
          }&goods_name=${this.commodityNameList.name}&erp_goods_code=${
            this.commodityNameList.code
          }&classid=${this.classNameList.code}&buyer=${
            this.purchaseList.name
          }&buyer_code=${this.purchaseList.code}&spec=${
            this.search.spec
          }&unit=${this.search.unit}&start_purchase_num=${
            this.search.start_purchase_num
          }&end_purchase_num=${this.search.end_purchase_num}&start_inp_num=${
            this.search.start_inp_num
          }&end_inp_num=${this.search.end_inp_num}&start_inp_price=${
            this.search.start_inp_price
          }&end_inp_price=${this.search.end_inp_price}&start_amount=${
            this.search.start_amount
          }&end_amount=${
            this.search.end_amount
          }&is_normal = ${is_normal}&orgarea_code_str=${
            this.search.area
          }&warehouse_code=${this.warehouseList.code}`;
          link.click();
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消导出",
          });
        });
    },
    optionsFiveMethods() {
      this.optionsFiveMinVal = "";
      this.optionsFiveMaxVal = "";
      this.search.start_purchase_price = "";
      this.search.end_purchase_price = "";
      this.search.start_inp_price = "";
      this.search.end_inp_price = "";
    },
    optionsSixMethods() {
      this.optionsSixMinVal = "";
      this.optionsSixMaxVal = "";
      this.search.start_purchase_num = "";
      this.search.end_purchase_num = "";
      this.search.start_inp_num = "";
      this.search.end_inp_num = "";
    },
    getSummaries(param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "合计";
          return;
        }
        const values = data.map((item) => Number(item[column.property]));
        if (!values.every((value) => isNaN(value))) {
          sums[index] = values.reduce((prev, curr) => {
            const value = Number(curr);
            if (!isNaN(value)) {
              return prev + curr;
            } else {
              return prev;
            }
          }, 0);
          if (
            index != 19 &&
            index != 20 &&
            index != 21 &&
            index != 22 &&
            index != 23 &&
            index != 24
          ) {
            sums[index] = "";
          } else {
            sums[index] = sums[index].toFixed(4);
          }
        } else {
          sums[index] = "";
        }
      });

      return sums;
    },
    // 本地搜索
    handleSearch() {
      if (this.date) {
        this.search.start_date = this.date[0];
        this.search.end_date = this.date[1];
      }

      this.pageData.page = 1;
      this.pageData.total = null;
      this.getData();
    },
    //刷新
    refresh() {
      this.empty();
      this.getData();
    },
    //清空
    empty() {
      this.date = [];
      this.date.push(this.normal_startime);
      this.date.push(this.normal_endtime);
      this.search = {
        start_date: this.normal_startime,
        end_date: this.normal_endtime,
        code: "",
        kind: "",
        is_normal: "",
        orgarea_name: "",
        supplier_type: "",
        supplier_code: "",
        supplier_name: "",
        goods_name: "",
        erp_goods_code: "",
        classid: "",
        buyer: "",
        buyer_code: "",
        spec: "",
        unit: "",
        start_purchase_num: "",
        end_purchase_num: "",
        start_inp_num: "",
        end_inp_num: "",
        start_purchase_price: "",
        end_purchase_price: "",
        start_inp_price: "",
        end_inp_price: "",
        start_amount: "",
        end_amount: "",
        area: "",
      };
      this.insideArea = {
        innerVisible: false,
        options: [],
        value: "",
        list: [],
        loading: false,
      };
      this.getAreaData();
      this.optionsSixMinVal = "";
      this.optionsSixMaxVal = "";
      this.optionsFiveMinVal = "";
      this.optionsFiveMaxVal = "";
      this.supplierNameList = {
        name: "",
        code: "",
      };
      this.commodityNameList = {
        name: "",
        code: "",
      };
      this.purchaseList = {
        name: "",
        code: "",
      };
      this.classNameList = {
        name: "",
        code: "",
      };
      this.warehouseList.name = "";
      this.warehouseList.code = "";
    },
    //每页多少条
    handleCurrentChange(val) {
      this.pageData.page = 1;
      this.pageData.pageSize = val;
      this.getData();
    },
    //选取页数
    handleSizeChange(page) {
      this.pageData.page = page;
      this.getData();
    },
  },
};
</script>
<style scoped>
.top {
  position: relative;
  margin-bottom: 5px;
  /* width: 1100px; */
}
.inpList {
  margin-bottom: 5px;
}
.add {
  position: absolute;
  right: 0;
  top: 4px;
}
.pagination {
  text-align: right;
  padding: 10px;
}
.el-select {
  width: 160px !important;
}
.inp {
  width: 100px;
}
.el-form-item {
  margin-bottom: 0px !important;
}
</style>